<?php

/**
 * xml类
 */

class Xml {
    
    public function getXmlHeader($domain) {
        Header("Content-type: application/xml");

        //xml头部分开始
        $tmp = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
        $tmp .= "<feed xmlns=\"http://www.w3.org/2005/Atom\" xmlns:thr=\"http://purl.org/syndication/thread/1.0\" xml:lang=\"zh-cn\" xml:base=\"http://{$domain}/index.php\">\n";
        $tmp .= "   <title>cn stanza</title>\n";
        $tmp .= "   <author>\n";
        $tmp .= "       <name>netxlong</name>\n";
        $tmp .= "       <uri>http://{$domain}/index.php</uri>\n";
        $tmp .= "       <email>netxlong.pan@gmail.com</email>\n";
        $tmp .= "   </author>\n";
        $tmp .= "   <subtitle>cn stanza </subtitle>\n";
        $tmp .= "   <link rel=\"search\" title=\"Search Catalog\" type=\"application/atom+xml\" href=\"http://{$domain}/index.php?action=list&amp;search={searchTerms}\" />\n";
        $tmp .= "   \n";
        //xml头部分结束 
        return $tmp;
    }
    
    public function getXmlFooter() {
        //xml尾部分开始
        $tmp .= "</feed>\n";
        //xml尾部分结束\
        
        return $tmp;
    }
}